<?php
$loader->requireOnce('controllers/C_IReportTemplate.class.php');

class C_Report02 extends Controller implements C_IReportTemplate {
    
    
    function __construct() {
        parent::Controller();                			
		$this->view->path = 'report2';
    }
    
    /**
     * (non-PHPdoc)
     * @see modules/report/local/controllers/C_IReportTemplate#actionDisplay()
     */
    function actionDisplay() {
        $filter = new ReportFilterDefault($this);
        $filter->setDateType(ReportFilterDefault::DATE_FROM_TO);        
        $filterHtml = $filter->renderFilter();
        
        $button = new ReportButton($this, ReportConstant::REPORT02);
        $button->addButton(ReportButton::BUTTON_VIEW);
        $button->addButton(ReportButton::BUTTON_PRINT);
        
        $buttonHtml = $button->renderButton();

        $this->assign('filter', $filterHtml);
        $this->assign('button', $buttonHtml);
        $this->assign('title', L10nHelper::_(ReportConstant::REPORT02_TITLE));
        return $this->view->render('display.html');
    }
    
    /**
     * (non-PHPdoc)
     * @see modules/report/local/controllers/C_IReportTemplate#actionView()
     */
    function actionView() {
        $report = ReportFactory::getReportInstance(ReportConstant::REPORT02, L10nHelper::_(ReportConstant::REPORT02_TITLE));
        
        $report->setDateRange($_POST['startDate'], $_POST['endDate']);
        return $report->viewReport($this);
    }
    
    /**
     * (non-PHPdoc)
     * @see modules/report/local/controllers/C_IReportTemplate#actionPrint()
     */
    function actionPrint() {        
        $report = ReportFactory::getReportInstance(ReportConstant::REPORT02, L10nHelper::_(ReportConstant::REPORT02_TITLE));
        
        $report->setDateRange($_GET['startDate'], $_GET['endDate']);
        return $report->viewReport($this, true);
    }
    
    /**
     * (non-PHPdoc)
     * @see modules/report/local/controllers/C_IReportTemplate#actionExport()
     */
    function actionExport() {
               
    }
}